const utils = require("../../utils/util.js")
const app = getApp();
Page({
  data: {
    title: '',
    content: ''
  },
  sendNotice() {
    utils.getData('addArticle', { articleTitle: this.data.title, articleContent: this.data.content, userId: app.userId }, "POST")
      .then(res => {
        console.log(res)
        if (res.data.success) {
          wx.reLaunch({
            url: '../discovery/discovery'
          })
        } else {
          wx.showToast({
            title: "程序内部错误，请稍后再试",
            icon: '',
            duration: 2000
          })
        }

      })
  },
  getTitle: function (e) {
    this.setData({
      title: e.detail.value
    })
  },
  getNotice: function (e) {
    this.setData({
      content: e.detail.value
    })
  }
})